{extend name="default/template/base_index" /}


{block name="area_header"}

    <link rel="stylesheet" type="text/css" media="all" href="__CDN__/jquery-datetimepicker/jquery.datetimepicker.css">
    <script type="text/javascript" src="__CDN__/jquery-datetimepicker/jquery.datetimepicker.js"></script>
<script type="text/javascript" src="__CDN__/jquery-validation/1.13.1/jquery.validate.min.js"></script>
	<script type="text/javascript" src="__CDN__/jquery-validation/1.13.1/localization/messages_zh.min.js"></script>

    <script type="text/javascript" charset="utf-8" src="__UPLOAD__/ueditor/1.4.3/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="__UPLOAD__/ueditor/1.4.3/ueditor.all.min.js"> </script>
	<link type="text/css" rel="stylesheet" href="__CDN__/comp/wxuploader.css?v=__APP_VERSION__" />
	<link type="text/css" rel="stylesheet" href="__CDN__/jquery-uploadify/3.2.1/uploadify.css" />
	<script type="text/javascript" src="__CDN__/jquery-uploadify/3.2.1/jquery.uploadify.min.js"></script>

{/block}

{block name="area_body"}
	{include file="default/Widget/topbar" /}
	<div class="admin-main container-fluid">
		{include file="default/Widget/left" /}
		<div class="admin-main-content">
			{include file="default/Widget/breadcrumb" /}
		
			<!-- 带验证 form -->
			<form class="form-horizontal well validateForm">
				<fieldset>
					<legend>
						</legend>
					<div class="form-group">
						<label for="inputtitle" class="col-md-2 col-lg-2 control-label">文章标题</label>
						<div class="col-md-10 col-lg-10">
							<input type="text" class="required form-control input-short" name="post_title" id="inputtitle" placeholder="{:L('PLACEHOLDER_TITLE')}">
							<div class="help-block">(请输入文章标题)</div>
						</div>
					</div>
					<div class="form-group">
						<label for="inputtitle" class="col-md-2 col-lg-2 control-label">文章状态</label>
						<div class="col-md-10 col-lg-10">
							<label class="radio-inline">
								<input type="radio" name="post_status" value="publish" checked="checked" />立即发布
							</label>
							<label class="radio-inline">
								<input type="radio" name="post_status" value="draft" />草稿
							</label>
						</div>
					</div>
					<div class="form-group  am-hide">
						<label for="inputtitle" class="col-md-2 col-lg-2 control-label">可否评论</label>
						<div class="col-md-10 col-lg-10">
							<label class="radio-inline">
								<input type="radio" name="comment_status"  checked="checked" value="closed" />禁止评论
							</label>
							<label class="radio-inline">
								<input type="radio" name="comment_status" value="open" />任何人都可评论
							</label>
							<label class="radio-inline">
								<input type="radio" name="comment_status" value="registered_only" />仅会员可评论
							</label>
						</div>
					</div>
					<div class="form-group">
						<label for="inputtitle" class="col-md-2 col-lg-2 control-label">文章缩略图</label>
						<div class="col-md-10 col-lg-10">							
							<input type="hidden" name="main_img" id="main_img" value="{$vo.main_img}" />
							
							<!-- 图片选择DOM结构 -->
							<div class="wxuploaderimg clearfix" data-maxitems="1">
								<div class="img-preview clearfix" >
									
								</div>
								<div class="add">
									<i class="fa fa-plus"></i>
								</div>
							</div>							
							<!-- 图片选择DOM结构 -->
							
						</div>
					</div>
                    <div class="form-group">
                        <label for="inputpost_excerpt" class="col-md-2 col-lg-2 control-label">文章在线时间</label>
                        <div class="col-md-10 col-lg-10" style="width: 480px;">
                                <div class="input-group">
                                    <input type="text" name="start_time" id="starttime" class="form-control input-normal" value="{:date('Y/m/d H:i',time())}" />
                                    <div class="input-group-addon">
                                        <i class="fa fa-long-arrow-right"></i>
                                    </div>
                                    <input type="text" name="end_time" id="endtime"  class="form-control input-normal" value="{:date('Y/m/d H:i',time()+31*24*3600)}" />
                                </div>
                        </div>
                    </div>
					<div class="form-group">
						<label for="inputpost_excerpt" class="col-md-2 col-lg-2 control-label">文章摘要</label>
						<div class="col-md-10 col-lg-10">
							<textarea name="post_excerpt" rows="5"  class="required form-control input-normal"></textarea>
							<div class="help-block">(请输入文章摘要)</div>
						</div>
					</div>
					
					<div class="form-group">
						<label for="inputpost_excerpt" class="col-md-2 col-lg-2 control-label">文章分类</label>
						<div class="col-md-10 col-lg-10">
							<select name="post_category" class="form-control input-normal" >
								{:w_datatree(getDatatree('HELP_POST_CATEGORY'),true)}
							</select>
							<div class="help-block">(请选择文章分类)</div>
						</div>
					</div>
					<div class="form-group">
						<label for="inputtitle" class="col-md-2 col-lg-2 control-label">文章内容</label>
						<div class="col-md-10 col-lg-10">							
							 <script id="ueditor" name="post_content" type="text/plain" style="height: 480px;" ></script>
						</div>
					</div>

                    <div class="form-group">
                        <label for="inputpost_excerpt" class="col-md-2 col-lg-2 control-label">原文链接或跳转链接(选填)</label>
                        <div class="col-md-10 col-lg-10">
                            <input type="text" class="form-control" name="jump_url" placeholder="原文链接、跳转链接">
                            <div class="help-block">(请输入文章原文链接或跳转链接)</div>
                        </div>
                    </div>
					<div class="form-group">
						<label for="btns" class="col-md-2 col-lg-2 control-label">&nbsp;</label>
						<div class="col-lg-10 col-md-10">
							<a target-form="validateForm" onclick="return getData();" class="ajax-post btn btn-primary" href="{:url('HelpCenter/add')}" autofocus="autofocus"><i class="fa fa-save"></i> {:L('BTN_SAVE')}</a>
							<a class="btn btn-default" href="{:url('HelpCenter/index')}"><i class="fa fa-reply"></i>返回</a>
						</div>
					</div>
				</fieldset>
			</form>
			<!-- form -->

			{include file="default/template/wxpicture" /}
		</div>
		<!-- END admin-main-content -->
	</div>
		<!-- END admin-main-->
{/block}

{block name="area_footer"}

<script>
    var ue = UE.getEditor('ueditor',{
    	toolbars:[
        ['fullscreen', 'source', 'undo', 'redo', 'bold','italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', '|','lineheight'
       , 'fontsize','justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', 'insertimage','emotion','link', 'unlink', 'anchor', '|','map','print', 'preview',  'drafts','forecolor','backcolor'
        ]
    ]});
	</script>
	<script type="text/javascript">

		function getData(){
			$("#main_img").val($(".wxuploaderimg img").attr("src"));		
		}
		
		$(function(){			
			wxuploadimg.init({cont:".wxuploaderimg"});

            $('#starttime').datetimepicker({
                lang: 'ch'
            });
            $('#endtime').datetimepicker({
                lang: 'ch'
            });
        })
    </script>
{/block}